"""
df.shift(periods=1, freq=None, axis=0)
    periods: 移动的幅度，可正可负
    freq: 只适用于时间序列
"""
import pandas as pd

data = [7532, 3937, 9447, 8765, 4564]
index = [1, 2, 3, 4, 5]
df = pd.DataFrame(data=data, index=index, columns=['OPPO'])
print(df)
print('----------------')
df['销量差'] = df['OPPO'] - df['OPPO'].shift()
print(df['OPPO'].shift())
print(df)
